package com.zeus.util;
import java.io.FileWriter;
import java.io.IOException;
/**
 * @author 冯扬龙
 * @date 2021/4/21 14:01
 * 支付宝支付模块
 */
public class AlipayConfig {

    /* *
     *类名：AlipayConfig
     *功能：基础配置类
     *详细：设置帐户有关信息及返回路径
     *修改日期：2017-04-05
     *说明：
     *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
     *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
     */
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2021000117642415";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC7c1nA6xU5vszO44yVatGQXqFgoD91nl389E4o1uthwEA7OBvHwD70YvT2/2tpZ7G3M8D1ERvBHULRxxtBZ20sKwfjar1vyMghcfkt/+8wEOVyT/7r18Okv+N6LZZU+lULEzlFG3z1pYgo0KG6IwSPaYkt8nvDgrZlO5xMdh2T8Gad/uyqx8deTtaFEYv2miENwKUXKzq+KA8DEsXZcWsAjYkmBuCy2T4hTd8Zc8fCvE+9E1tgAJ93F4KJ1DOMXZrn5doFeJxsWUYVfbKluUlXr04ElwYPTNJz0UwTgQwxIlLlzLrm6yG6I5aiqKMdwC6eZzOh9ct0nYIEUC/0QUFRAgMBAAECggEAfqXd81khuyUtjW7ykhVcx9UX5Yf/uEEqsXiCwlcLK71P6HLtWhWKs2WUqrlB4jJ8QRJHgYxwmxZhCgkjYho2Ccx9BOseWMNobChsOeccvPX9gDGKQ+BAwDQhxm+8jWehQ91WKVn8IKAZkbH8Qx3bu+WLGK8nbZ4IC/etj3+SVlvBp6CNwzVrrYjZnIGKcy63fOrn5FH3qBalT/mJk8RuLhcRnJhuKiiwNOrVBtjR+xU9kBZkjwUSDb80VFUwv9sOmjRXXiLjK77SR9SI4P6aPE1p7BhCu3Ig8SHb5o/OFTabhVZDpNfkDkOSpKcCuzD2ZBzYO36F/cihhbW+8HY2EQKBgQD1GI90bXNcwhlgRnM21BsgPcLxmqikLJIHJI3p+QpexgUzZX2xnWXrKX6bDa+qJH2JneNX6ocKfRtUMKDeji6N3gJBKDKUjrECRD+b1kMzAd0PPmG090z3mfUS8QMXzmy/2HqnjWLv7S9M6lmdkS82JAryh0p9zsdHrhzTuwqVPQKBgQDDykHotvReYe2UUuS2FjErH65lp3qsY0kvq+Em49qjVlcZ68sAjPp/7uTw6Nc98XUWa2NlXFy1ZnxDsk1lBlkyEVj4Y8GNGOx4KNPvrwwa1u+tedPY221fPBtXAWODEsyC4aXyv0K0/nasYteqbOQfdODMqwv2NkpTKR1hhKZlpQKBgE5UkBxkknb1rYiAW3gNZ7HxKyluBTGa8PyJaTV6mx7Y6HaZnAc0x4rVkxnY0OhuixR9OlgxowDuJNrOQ8t841IBvvS19RxXUijoSO/0FTvq/4xMootkcdu7/4ATOKrWFRlnBSQhYppNUk2hpAxghxclg74pENyORlAZTCs63tH9AoGBAJJyKrJiho5COW6EQkZgew6Cd/PZPczLxuY9bf+k1tjtr+DXmdQjnwsqKVx5DOZsQOQwFvyuBTo6GiCYsYMrKHRmvWGtXAyp49ZM05moGSnKMyRSx76hAkIFt31wsHpOCWKsXXAg10iCPUnb9Oyo3kkZJzxvhFb5bMafLjbO/ZdxAoGBAMy7ZP4kQP9GjXMV3vZblBJJ+8w8D95kZ7Wunpki3i2auJ8iuh67SIOqSkxqKSPp26klM7oY3+CfrJ3KRbhxu5J2zHk91VbbK6KpCvN1R0aSh83YHPNErpIxrtKAQ9BlIA19setCxZlnET8SRCxIasyWZpLVp1n6WVEwB5b9iVvl";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApKBVY7QC8BRqjWvxvR2O7pfh7aS34JtBV+cwKhOy18mnLQOgVzoxeP+g3P+YUDmXBGnkaP16lQL2z5CJOMlIL+F8ZWH0NCBJXFBv1HkZwFpaLjYxoolUDOsDcndVWQrgCCKJoauDyPQJe7gfJFBoOhfsc0x6dC9k0vvfEXH23/ISyW8/Ela9My59W+pY74UWxhYvsG0Kuiq5iuCPszu8B49940xEGdYg1vWwxyRDVn4uJAepRAIgpHwedKAvzKw/0KZucdGpOc/2shwPZXJ+7ik93bQntLgdMxAV80q9mUcY8YQJkBs2aeXymAIqWf2i6RhY2SsJHyjiEqVsFjqiEQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8080/pay/notifyUrl";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8080/pay/returnUrl";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     *
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
